*&---------------------------------------------------------------------*
*& 包含               ZFIU026_F01
*&---------------------------------------------------------------------*
*&---------------------------------------------------------------------*
*& Form FRM_GET_DATA
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& -->  p1        text
*& <--  p2        text
*&---------------------------------------------------------------------*
FORM FRM_GET_DATA .
  DATA:
    LV_JSDZT         TYPE ZFIT079_HEAD-JSDZT,
    LV_JSDDH         TYPE ZFIT079_HEAD-JSDDH,
    LT_ZFIT078_HIS   TYPE TABLE OF ZFIT078_HIS WITH HEADER LINE,
    LT_BKPF          TYPE TABLE OF BKPF WITH HEADER LINE,
    LT_ZFIT078_HEAD1 TYPE TABLE OF ZFIT078_HEAD WITH HEADER LINE, "国外发票
    LT_ZFIT078_HEAD  TYPE TABLE OF ZFIT078_HEAD WITH HEADER LINE.

  IF P_GWINV IS INITIAL AND P_GNINV IS INITIAL.
    MESSAGE '国内或国外发票至少选择一项'(M04) TYPE 'S' DISPLAY LIKE 'E'.
    LEAVE LIST-PROCESSING.
  ENDIF.

  REFRESH GT_RESULT[].

  "获取国内发票数据
  IF P_GNINV IS NOT INITIAL.
    SELECT *
      INTO TABLE LT_ZFIT078_HEAD
      FROM ZFIT078_HEAD
     WHERE ZFPHM IN S_ZFPHM
       AND LIFNR IN S_LIFNR
       AND BUKRS IN S_BUKRS
       AND ZKPSJ IN S_ZKPSJ
       AND ZXFMC IN S_ZXFMC.
  ENDIF.

  "获取国外发票数据
  IF P_GWINV IS NOT INITIAL.
    SELECT
      "ZYWLX
      ZFPHM
      ZKPSJ
      BUKRS
      ZGFMC
      LIFNR
      ZXFMC
      ZHSJE
      ZHJSE
      ZBHSJE
      WAERS
      INTO CORRESPONDING FIELDS OF TABLE LT_ZFIT078_HEAD1
      FROM ZFIT079_HEAD
     WHERE JSDZT <> '04' "作废
       AND ZYWLX = '02'  "国外发票
       AND ZFPHM IN S_ZFPHM
       AND LIFNR IN S_LIFNR
       AND BUKRS IN S_BUKRS
       AND ZKPSJ IN S_ZKPSJ
       AND ZXFMC IN S_ZXFMC.

    LOOP AT LT_ZFIT078_HEAD1.
      LT_ZFIT078_HEAD1-SPECIAL_INVOICE_TYPE = 'ZZGW'.
      APPEND LT_ZFIT078_HEAD1 TO LT_ZFIT078_HEAD.
    ENDLOOP.

  ENDIF.

  IF LT_ZFIT078_HEAD[] IS INITIAL.
    MESSAGE '未找到发票数据，请检查查询条件'(M01) TYPE 'S' DISPLAY LIKE 'E'.
    LEAVE LIST-PROCESSING.
  ENDIF.

  SELECT *
    INTO TABLE LT_ZFIT078_HIS
    FROM ZFIT078_HIS
     FOR ALL ENTRIES IN LT_ZFIT078_HEAD
   WHERE ZFPHM = LT_ZFIT078_HEAD-ZFPHM.

  IF LT_ZFIT078_HIS[] IS NOT INITIAL.
    SELECT *
      FROM BKPF
      INTO TABLE LT_BKPF
       FOR ALL ENTRIES IN LT_ZFIT078_HIS
     WHERE BUKRS IN S_BUKRS
       AND BELNR = LT_ZFIT078_HIS-BELNR
       AND GJAHR = LT_ZFIT078_HIS-GJAHR.

  ENDIF.

  SELECT
    A~JSDDH,
    A~ZFPHM,
    A~JSDZT,
    B~ZYSFPHM
    INTO TABLE @DATA(LT_INV_CF)
    FROM ZFIT079_HEAD AS A
    JOIN ZFIT079_ITEM AS B
      ON A~JSDDH = B~JSDDH
     FOR ALL ENTRIES IN @LT_ZFIT078_HEAD
   WHERE B~ZYSFPHM = @LT_ZFIT078_HEAD-ZFPHM
     AND A~ZFPHM LIKE '%-CF%' "包含拆分字样
     AND A~JSDZT <> '04' "作废
     AND A~ZYWLX <> '02'.  "国外发票


  SORT LT_BKPF BY BUKRS BELNR GJAHR.
  SORT LT_ZFIT078_HIS BY ZFPHM CHDAT DESCENDING CHTIM DESCENDING.

  LOOP AT LT_ZFIT078_HEAD.
    CLEAR GT_RESULT.
    MOVE-CORRESPONDING LT_ZFIT078_HEAD TO GT_RESULT.

    READ TABLE LT_ZFIT078_HIS
      WITH KEY ZFPHM = LT_ZFIT078_HEAD-ZFPHM
      BINARY SEARCH.
    IF SY-SUBRC = 0.
      MOVE-CORRESPONDING LT_ZFIT078_HIS TO GT_RESULT.
      GT_RESULT-CHNAM_HIS = LT_ZFIT078_HIS-CHNAM.
      GT_RESULT-CHDAT_HIS = LT_ZFIT078_HIS-CHDAT.
      GT_RESULT-CHTIM_HIS = LT_ZFIT078_HIS-CHTIM.
    ENDIF.

    "国外发票
    IF LT_ZFIT078_HEAD-SPECIAL_INVOICE_TYPE = 'ZZGW'. "国外发票
      GT_RESULT-ZFPLX = '国外'(t02).

    ELSE. " 国内发票 拆分发票，结算单状态不一致，则清空发票状态
      GT_RESULT-ZFPLX = '国内'(t03).

      CLEAR LV_JSDZT.
      LOOP AT LT_INV_CF INTO DATA(LS_INV_CF) WHERE ZYSFPHM = LT_ZFIT078_HEAD-ZFPHM.
        IF LV_JSDZT IS INITIAL.
          LV_JSDZT = LS_INV_CF-JSDZT.
        ENDIF.

        IF LV_JSDZT <> LS_INV_CF-JSDZT.
          CLEAR:
           GT_RESULT-ZFPZT,
           GT_RESULT-ZNONO_RZZT,
           GT_RESULT-ZNONO_BXZT,
           GT_RESULT-ZNONO_GXZT.

          GT_RESULT-MSG = '发票被拆分且状态不一致，具体请点开详细历史查看'(T04).
          EXIT.
        ENDIF.
      ENDLOOP.

      "判断一张发票是否有多个结算单
      IF GT_RESULT-MSG IS INITIAL.
        CLEAR LV_JSDDH.
        LOOP AT LT_INV_CF INTO LS_INV_CF WHERE ZYSFPHM = LT_ZFIT078_HEAD-ZFPHM.
          IF LV_JSDDH IS INITIAL.
            LV_JSDDH = LS_INV_CF-JSDDH.

          ELSE.
            IF LV_JSDDH <> LS_INV_CF-JSDDH.
              GT_RESULT-MSG = '发票被拆分'(T05).
              EXIT.
            ENDIF.
          ENDIF.
        ENDLOOP.
      ENDIF.
    ENDIF.

    "过账日期
    IF GT_RESULT-BELNR IS NOT INITIAL AND GT_RESULT-GJAHR IS NOT INITIAL.
      CLEAR LT_BKPF.
      READ TABLE LT_BKPF WITH KEY
        BUKRS = GT_RESULT-BUKRS
        BELNR = GT_RESULT-BELNR
        GJAHR = GT_RESULT-GJAHR
        BINARY SEARCH.

      GT_RESULT-BUDAT = LT_BKPF-BUDAT.
    ENDIF.

    IF GT_RESULT-ZFPZT IS NOT INITIAL.
      PERFORM FRM_READ_DOMAIN_TEXT USING GT_RESULT-ZFPZT 'ZDO_ZFPZT' CHANGING GT_RESULT-ZFPZT_TXT.
    ENDIF.

    IF GT_RESULT-ZNONO_RZZT IS NOT INITIAL.
      PERFORM FRM_READ_DOMAIN_TEXT USING GT_RESULT-ZNONO_RZZT 'ZDO_NONO_RZZT' CHANGING GT_RESULT-ZNONO_RZZT_TXT.
    ENDIF.

    IF GT_RESULT-ZNONO_BXZT IS NOT INITIAL.
      PERFORM FRM_READ_DOMAIN_TEXT USING GT_RESULT-ZNONO_BXZT 'ZDO_NONO_BXZT' CHANGING GT_RESULT-ZNONO_BXZT_TXT.
    ENDIF.

    IF GT_RESULT-ZNONO_GXZT IS NOT INITIAL.
      PERFORM FRM_READ_DOMAIN_TEXT USING GT_RESULT-ZNONO_GXZT 'ZDO_NONO_GXZT' CHANGING GT_RESULT-ZNONO_GXZT_TXT.
    ENDIF.

    APPEND GT_RESULT.
  ENDLOOP.

  IF S_JSDDH[] IS NOT INITIAL.
    DELETE GT_RESULT WHERE JSDDH NOT IN S_JSDDH.
  ENDIF.

  IF S_DOCID[] IS NOT INITIAL.
    DELETE GT_RESULT WHERE DOCID NOT IN S_DOCID.
  ENDIF.

  IF S_BUDAT IS NOT INITIAL.
    DELETE GT_RESULT WHERE BUDAT NOT IN S_BUDAT.
  ENDIF.

  IF S_ZFPZT[] IS NOT INITIAL.
    DELETE GT_RESULT WHERE ZFPLX = '国内' AND ZFPZT NOT IN S_ZFPZT.
  ENDIF.

  IF S_ZRZZT[] IS NOT INITIAL.
    DELETE GT_RESULT WHERE ZFPLX = '国内' AND ZNONO_RZZT NOT IN S_ZRZZT.
  ENDIF.

  IF S_ZBXZT[] IS NOT INITIAL.
    DELETE GT_RESULT WHERE ZFPLX = '国内' AND ZNONO_BXZT NOT IN S_ZBXZT.
  ENDIF.

  IF S_ZGXZT[] IS NOT INITIAL.
    DELETE GT_RESULT WHERE ZFPLX = '国内' AND ZNONO_GXZT NOT IN S_ZGXZT.
  ENDIF.

  IF GT_RESULT[] IS INITIAL.
    MESSAGE '未找到发票数据，请检查查询条件'(M01) TYPE 'S' DISPLAY LIKE 'E'.
    LEAVE LIST-PROCESSING.
  ENDIF.

  SORT GT_RESULT BY ZKPSJ DESCENDING.
ENDFORM.

*&---------------------------------------------------------------------*
*& Form FRM_DIS_HISTORY
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*&      --> LS_RESULT
*&---------------------------------------------------------------------*
FORM FRM_DIS_HISTORY  USING IS_RESULT TYPE TY_RESULT.

  DATA:
    LR_DISPLAY   TYPE REF TO CL_SALV_DISPLAY_SETTINGS,
    LR_FUNC_LIST TYPE REF TO CL_SALV_FUNCTIONS_LIST,
    LR_EVENTS    TYPE REF TO CL_SALV_EVENTS_TABLE,
    LR_SELECTS   TYPE REF TO CL_SALV_SELECTIONS,
    LR_COLUMNS   TYPE REF TO CL_SALV_COLUMNS_TABLE,
    LR_COLUMN    TYPE REF TO CL_SALV_COLUMN_TABLE,
    LR_LAYOUT    TYPE REF TO CL_SALV_LAYOUT,
    LS_DDIC      TYPE SALV_S_DDIC_REFERENCE,
    LS_KEY       TYPE SALV_S_LAYOUT_KEY.

  REFRESH GT_HISTORY[].

  SELECT *
    INTO CORRESPONDING FIELDS OF TABLE GT_HISTORY
    FROM ZFIT078_HIS
   WHERE ZFPHM = IS_RESULT-ZFPHM.

  IF SY-SUBRC <> 0.
    MESSAGE '未找到发票历史数据'(M03) TYPE 'I'.
    RETURN.
  ENDIF.

  LOOP AT GT_HISTORY.
    IF GT_HISTORY-ZFPZT IS NOT INITIAL.
      PERFORM FRM_READ_DOMAIN_TEXT USING GT_HISTORY-ZFPZT 'ZDO_ZFPZT' CHANGING GT_HISTORY-ZFPZT_TXT.
    ENDIF.

    IF GT_HISTORY-ZNONO_RZZT IS NOT INITIAL.
      PERFORM FRM_READ_DOMAIN_TEXT USING GT_HISTORY-ZNONO_RZZT 'ZDO_NONO_RZZT' CHANGING GT_HISTORY-ZNONO_RZZT_TXT.
    ENDIF.

    IF GT_HISTORY-ZNONO_BXZT IS NOT INITIAL.
      PERFORM FRM_READ_DOMAIN_TEXT USING GT_HISTORY-ZNONO_BXZT 'ZDO_NONO_BXZT' CHANGING GT_HISTORY-ZNONO_BXZT_TXT.
    ENDIF.

    IF GT_HISTORY-ZNONO_GXZT IS NOT INITIAL.
      PERFORM FRM_READ_DOMAIN_TEXT USING GT_HISTORY-ZNONO_GXZT 'ZDO_NONO_GXZT' CHANGING GT_HISTORY-ZNONO_GXZT_TXT.
    ENDIF.

    GT_HISTORY-BUKRS = IS_RESULT-BUKRS.
    MODIFY GT_HISTORY.
  ENDLOOP.

  SORT GT_HISTORY BY CHDAT DESCENDING CHTIM DESCENDING.

  TRY.
      CL_SALV_TABLE=>FACTORY(
        IMPORTING
          R_SALV_TABLE = GR_TABLE_HIS
        CHANGING
          T_TABLE      = GT_HISTORY[]
      ).
    CATCH CX_SALV_MSG.
  ENDTRY.

  "设置列Lable
  LR_COLUMNS = GR_TABLE_HIS->GET_COLUMNS( ).
  LR_COLUMNS->SET_OPTIMIZE( 'X' ).
  LR_COLUMNS->SET_KEY_FIXATION( 'X' ).

  "显示设置
  LR_DISPLAY = GR_TABLE_HIS->GET_DISPLAY_SETTINGS( ).
  LR_DISPLAY->SET_STRIPED_PATTERN( 'X' ). "设置颜色间隔显示

  "设置选择模式
  LR_SELECTS = GR_TABLE_HIS->GET_SELECTIONS( ).
  LR_SELECTS->SET_SELECTION_MODE( CL_SALV_SELECTIONS=>IF_SALV_C_SELECTION_MODE~CELL ).

  "STAUTS ALV 标准功能
  LR_FUNC_LIST = GR_TABLE_HIS->GET_FUNCTIONS( ).
  LR_FUNC_LIST->SET_ALL( 'X' ).

  "设置ALV自定义按钮功能
*  GR_TABLE->SET_SCREEN_STATUS(
*    PFSTATUS      = '9000'
*    REPORT        = SY-REPID
*    SET_FUNCTIONS = GR_TABLE->C_FUNCTIONS_ALL ).

  "打开Layout保存功能
  LR_LAYOUT = GR_TABLE_HIS->GET_LAYOUT( ).
  LS_KEY-REPORT = SY-REPID.
  LS_KEY-LOGICAL_GROUP = '0002'.
  LR_LAYOUT->SET_KEY( LS_KEY ).
  LR_LAYOUT->SET_DEFAULT( ABAP_TRUE ).
  LR_LAYOUT->SET_SAVE_RESTRICTION( IF_SALV_C_LAYOUT=>RESTRICT_NONE ).

  " Add Hotspot Handlers
  LR_EVENTS = GR_TABLE_HIS->GET_EVENT( ).
  CREATE OBJECT GR_EVENTS_HANDLER. "type ref to lcl_events.
  SET HANDLER GR_EVENTS_HANDLER->ON_LINK_CLICK_HIS   FOR LR_EVENTS.

  TRY .
      LR_COLUMN  ?= LR_COLUMNS->GET_COLUMN( 'JSDDH' ).
      LR_COLUMN->SET_CELL_TYPE( IF_SALV_C_CELL_TYPE=>HOTSPOT ).
    CATCH CX_SALV_NOT_FOUND.
  ENDTRY.

  TRY .
      LR_COLUMN  ?= LR_COLUMNS->GET_COLUMN( 'DOCID' ).
      LR_COLUMN->SET_CELL_TYPE( IF_SALV_C_CELL_TYPE=>HOTSPOT ).
    CATCH CX_SALV_NOT_FOUND.
  ENDTRY.

  TRY .
      LR_COLUMN  ?= LR_COLUMNS->GET_COLUMN( 'BELNR' ).
      LR_COLUMN->SET_CELL_TYPE( IF_SALV_C_CELL_TYPE=>HOTSPOT ).
    CATCH CX_SALV_NOT_FOUND.
  ENDTRY.

  TRY .
      LR_COLUMN  ?= LR_COLUMNS->GET_COLUMN( 'ZNONO_RZZT' ).
      LS_DDIC-TABLE = 'ZFIT078_HIS'.
      LS_DDIC-FIELD = 'ZNONO_RZZT'.
      LR_COLUMN->SET_DDIC_REFERENCE( LS_DDIC ).
    CATCH CX_SALV_NOT_FOUND.
  ENDTRY.

  TRY .
      LR_COLUMN  ?= LR_COLUMNS->GET_COLUMN( 'ZNONO_GXZT' ).
      LS_DDIC-TABLE = 'ZFIT078_HIS'.
      LS_DDIC-FIELD = 'ZNONO_GXZT'.
      LR_COLUMN->SET_DDIC_REFERENCE( LS_DDIC ).
    CATCH CX_SALV_NOT_FOUND.
  ENDTRY.

  TRY .
      LR_COLUMN  ?= LR_COLUMNS->GET_COLUMN( 'ZNONO_BXZT' ).
      LS_DDIC-TABLE = 'ZFIT078_HIS'.
      LS_DDIC-FIELD = 'ZNONO_BXZT'.
      LR_COLUMN->SET_DDIC_REFERENCE( LS_DDIC ).
      " LR_COLUMN->SET_VISIBLE( ABAP_FALSE ).
    CATCH CX_SALV_NOT_FOUND.
  ENDTRY.

  TRY .
      LR_COLUMN  ?= LR_COLUMNS->GET_COLUMN( 'ZFPZT_TXT' ).
      LR_COLUMN->SET_SHORT_TEXT( '处理状态描述'(H01) ).
      LR_COLUMN->SET_MEDIUM_TEXT( '处理状态描述'(H01) ).
      LR_COLUMN->SET_LONG_TEXT( '处理状态描述'(H01) ).
    CATCH CX_SALV_NOT_FOUND.
  ENDTRY.

  TRY .
      LR_COLUMN  ?= LR_COLUMNS->GET_COLUMN( 'ZNONO_RZZT_TXT' ).
      LR_COLUMN->SET_SHORT_TEXT( '入账状态描述'(H03) ).
      LR_COLUMN->SET_MEDIUM_TEXT( '入账状态描述'(H03) ).
      LR_COLUMN->SET_LONG_TEXT( '入账状态描述'(H03) ).
    CATCH CX_SALV_NOT_FOUND.
  ENDTRY.

  TRY .
      LR_COLUMN  ?= LR_COLUMNS->GET_COLUMN( 'ZNONO_BXZT_TXT' ).
      LR_COLUMN->SET_SHORT_TEXT( '报销状态描述'(H06) ).
      LR_COLUMN->SET_MEDIUM_TEXT( '报销状态描述'(H06) ).
      LR_COLUMN->SET_LONG_TEXT( '报销状态描述'(H06) ).
    CATCH CX_SALV_NOT_FOUND.
  ENDTRY.

  TRY .
      LR_COLUMN  ?= LR_COLUMNS->GET_COLUMN( 'ZNONO_GXZT_TXT' ).
      LR_COLUMN->SET_SHORT_TEXT( '勾选状态描述'(H04) ).
      LR_COLUMN->SET_MEDIUM_TEXT( '勾选状态描述'(H04) ).
      LR_COLUMN->SET_LONG_TEXT( '勾选状态描述'(H04) ).
    CATCH CX_SALV_NOT_FOUND.
  ENDTRY.

  TRY .
      LR_COLUMN  ?= LR_COLUMNS->GET_COLUMN( 'DOCID' ).
      LR_COLUMN->SET_SHORT_TEXT( 'DP 单号'(H02) ).
      LR_COLUMN->SET_MEDIUM_TEXT( 'DP 单号'(H02) ).
      LR_COLUMN->SET_LONG_TEXT( 'DP 单号'(H02) ).
    CATCH CX_SALV_NOT_FOUND.
  ENDTRY.

  "弹出窗口设置
  GR_TABLE_HIS->SET_SCREEN_POPUP(
    START_COLUMN = 1
    END_COLUMN   = 120
    START_LINE   = 1
    END_LINE     = 20 ).

  GR_TABLE_HIS->DISPLAY( ).
ENDFORM.

*&---------------------------------------------------------------------*
*& Form FRM_ALV_DISPLAY
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& -->  p1        text
*& <--  p2        text
*&---------------------------------------------------------------------*
FORM FRM_ALV_DISPLAY .

  DATA:
    LR_DISPLAY   TYPE REF TO CL_SALV_DISPLAY_SETTINGS,
    LR_FUNC_LIST TYPE REF TO CL_SALV_FUNCTIONS_LIST,
    LR_EVENTS    TYPE REF TO CL_SALV_EVENTS_TABLE,
    LR_SELECTS   TYPE REF TO CL_SALV_SELECTIONS,
    LR_COLUMNS   TYPE REF TO CL_SALV_COLUMNS_TABLE,
    LR_COLUMN    TYPE REF TO CL_SALV_COLUMN_TABLE,
    LR_LAYOUT    TYPE REF TO CL_SALV_LAYOUT,
    LS_DDIC      TYPE SALV_S_DDIC_REFERENCE,
    LS_KEY       TYPE SALV_S_LAYOUT_KEY.

  TRY.
      CL_SALV_TABLE=>FACTORY(
        IMPORTING
          R_SALV_TABLE = GR_TABLE
        CHANGING
          T_TABLE      = GT_RESULT[]
      ).
    CATCH CX_SALV_MSG.
  ENDTRY.

  "设置列Lable
  LR_COLUMNS = GR_TABLE->GET_COLUMNS( ).
  LR_COLUMNS->SET_OPTIMIZE( 'X' ).
  LR_COLUMNS->SET_KEY_FIXATION( 'X' ).

  "显示设置
  LR_DISPLAY = GR_TABLE->GET_DISPLAY_SETTINGS( ).
  LR_DISPLAY->SET_STRIPED_PATTERN( 'X' ). "设置颜色间隔显示

  "设置选择模式
  LR_SELECTS = GR_TABLE->GET_SELECTIONS( ).
  LR_SELECTS->SET_SELECTION_MODE( CL_SALV_SELECTIONS=>IF_SALV_C_SELECTION_MODE~CELL ).

  "STAUTS ALV 标准功能
*  LR_FUNC_LIST = GR_TABLE->GET_FUNCTIONS( ).
*  LR_FUNC_LIST->SET_ALL( 'X' ).

  "设置ALV自定义按钮功能
  GR_TABLE->SET_SCREEN_STATUS(
    PFSTATUS      = '9000'
    REPORT        = SY-REPID
    SET_FUNCTIONS = GR_TABLE->C_FUNCTIONS_ALL ).

  "打开Layout保存功能
  LR_LAYOUT = GR_TABLE->GET_LAYOUT( ).
  LS_KEY-REPORT = SY-REPID.
  LS_KEY-LOGICAL_GROUP = '0001'.
  LR_LAYOUT->SET_KEY( LS_KEY ).
  LR_LAYOUT->SET_DEFAULT( ABAP_TRUE ).
  LR_LAYOUT->SET_SAVE_RESTRICTION( IF_SALV_C_LAYOUT=>RESTRICT_NONE ).

  " Add Hotspot Handlers
  LR_EVENTS = GR_TABLE->GET_EVENT( ).
  CREATE OBJECT GR_EVENTS_HANDLER. "type ref to lcl_events.
  SET HANDLER GR_EVENTS_HANDLER->ON_LINK_CLICK   FOR LR_EVENTS.
  SET HANDLER GR_EVENTS_HANDLER->ON_USER_COMMAND FOR LR_EVENTS.

  TRY .
      LR_COLUMN  ?= LR_COLUMNS->GET_COLUMN( 'JSDDH' ).
      LR_COLUMN->SET_CELL_TYPE( IF_SALV_C_CELL_TYPE=>HOTSPOT ).
    CATCH CX_SALV_NOT_FOUND.
  ENDTRY.

  TRY .
      LR_COLUMN  ?= LR_COLUMNS->GET_COLUMN( 'DOCID' ).
      LR_COLUMN->SET_CELL_TYPE( IF_SALV_C_CELL_TYPE=>HOTSPOT ).
    CATCH CX_SALV_NOT_FOUND.
  ENDTRY.

  TRY .
      LR_COLUMN  ?= LR_COLUMNS->GET_COLUMN( 'BELNR' ).
      LR_COLUMN->SET_CELL_TYPE( IF_SALV_C_CELL_TYPE=>HOTSPOT ).
    CATCH CX_SALV_NOT_FOUND.
  ENDTRY.

  TRY .
      LR_COLUMN  ?= LR_COLUMNS->GET_COLUMN( 'PDF_URL' ).
      LR_COLUMN->SET_CELL_TYPE( IF_SALV_C_CELL_TYPE=>HOTSPOT ).
    CATCH CX_SALV_NOT_FOUND.
  ENDTRY.

  TRY .
      LR_COLUMN  ?= LR_COLUMNS->GET_COLUMN( 'XML_URL' ).
      LR_COLUMN->SET_CELL_TYPE( IF_SALV_C_CELL_TYPE=>HOTSPOT ).
    CATCH CX_SALV_NOT_FOUND.
  ENDTRY.

  TRY .
      LR_COLUMN  ?= LR_COLUMNS->GET_COLUMN( 'ZFPZT' ).
      LS_DDIC-TABLE = 'ZFIT078_HIS'.
      LS_DDIC-FIELD = 'ZFPZT'.
      LR_COLUMN->SET_DDIC_REFERENCE( LS_DDIC ).
      LR_COLUMN->SET_VISIBLE( ABAP_FALSE ).
    CATCH CX_SALV_NOT_FOUND.
  ENDTRY.

  TRY .
      LR_COLUMN  ?= LR_COLUMNS->GET_COLUMN( 'ZFPZT_TXT' ).
      LR_COLUMN->SET_SHORT_TEXT( '处理状态描述'(H01) ).
      LR_COLUMN->SET_MEDIUM_TEXT( '处理状态描述'(H01) ).
      LR_COLUMN->SET_LONG_TEXT( '处理状态描述'(H01) ).
    CATCH CX_SALV_NOT_FOUND.
  ENDTRY.

  TRY .
      LR_COLUMN  ?= LR_COLUMNS->GET_COLUMN( 'DOCID' ).
      LR_COLUMN->SET_SHORT_TEXT( 'DP 单号'(H02) ).
      LR_COLUMN->SET_MEDIUM_TEXT( 'DP 单号'(H02) ).
      LR_COLUMN->SET_LONG_TEXT( 'DP 单号'(H02) ).
    CATCH CX_SALV_NOT_FOUND.
  ENDTRY.

  TRY .
      LR_COLUMN  ?= LR_COLUMNS->GET_COLUMN( 'ZNONO_RZZT_TXT' ).
      LR_COLUMN->SET_SHORT_TEXT( '入账状态描述'(H03) ).
      LR_COLUMN->SET_MEDIUM_TEXT( '入账状态描述'(H03) ).
      LR_COLUMN->SET_LONG_TEXT( '入账状态描述'(H03) ).
    CATCH CX_SALV_NOT_FOUND.
  ENDTRY.

  TRY .
      LR_COLUMN  ?= LR_COLUMNS->GET_COLUMN( 'ZNONO_BXZT_TXT' ).
      LR_COLUMN->SET_SHORT_TEXT( '报销状态描述'(H06) ).
      LR_COLUMN->SET_MEDIUM_TEXT( '报销状态描述'(H06) ).
      LR_COLUMN->SET_LONG_TEXT( '报销状态描述'(H06) ).
    CATCH CX_SALV_NOT_FOUND.
  ENDTRY.

  TRY .
      LR_COLUMN  ?= LR_COLUMNS->GET_COLUMN( 'ZNONO_GXZT_TXT' ).
      LR_COLUMN->SET_SHORT_TEXT( '勾选状态描述'(H04) ).
      LR_COLUMN->SET_MEDIUM_TEXT( '勾选状态描述'(H04) ).
      LR_COLUMN->SET_LONG_TEXT( '勾选状态描述'(H04) ).
    CATCH CX_SALV_NOT_FOUND.
  ENDTRY.

  TRY .
      LR_COLUMN  ?= LR_COLUMNS->GET_COLUMN( 'ZNONO_RZZT' ).
      LS_DDIC-TABLE = 'ZFIT078_HIS'.
      LS_DDIC-FIELD = 'ZNONO_RZZT'.
      LR_COLUMN->SET_DDIC_REFERENCE( LS_DDIC ).
      LR_COLUMN->SET_VISIBLE( ABAP_FALSE ).
    CATCH CX_SALV_NOT_FOUND.
  ENDTRY.

  TRY .
      LR_COLUMN  ?= LR_COLUMNS->GET_COLUMN( 'ZNONO_GXZT' ).
      LS_DDIC-TABLE = 'ZFIT078_HIS'.
      LS_DDIC-FIELD = 'ZNONO_GXZT'.
      LR_COLUMN->SET_DDIC_REFERENCE( LS_DDIC ).
      LR_COLUMN->SET_VISIBLE( ABAP_FALSE ).
    CATCH CX_SALV_NOT_FOUND.
  ENDTRY.

  TRY .
      LR_COLUMN  ?= LR_COLUMNS->GET_COLUMN( 'ZNONO_BXZT' ).
      LS_DDIC-TABLE = 'ZFIT078_HIS'.
      LS_DDIC-FIELD = 'ZNONO_BXZT'.
      LR_COLUMN->SET_DDIC_REFERENCE( LS_DDIC ).
      LR_COLUMN->SET_VISIBLE( ABAP_FALSE ).
    CATCH CX_SALV_NOT_FOUND.
  ENDTRY.

  TRY .
      LR_COLUMN  ?= LR_COLUMNS->GET_COLUMN( 'ZFPLX' ).
      LR_COLUMN->SET_SHORT_TEXT( '发票类型'(H05) ).
      LR_COLUMN->SET_MEDIUM_TEXT( '发票类型'(H05) ).
      LR_COLUMN->SET_LONG_TEXT( '发票类型'(H05) ).
    CATCH CX_SALV_NOT_FOUND.
  ENDTRY.

  TRY .
      LR_COLUMN  ?= LR_COLUMNS->GET_COLUMN( 'BUKRS' ).
      LR_COLUMN->SET_VISIBLE( ABAP_FALSE ).
    CATCH CX_SALV_NOT_FOUND.
  ENDTRY.

  TRY .
      LR_COLUMN  ?= LR_COLUMNS->GET_COLUMN( 'MANDT' ).
      LR_COLUMN->SET_VISIBLE( ABAP_FALSE ).
    CATCH CX_SALV_NOT_FOUND.
  ENDTRY.

  TRY .
      LR_COLUMN  ?= LR_COLUMNS->GET_COLUMN( 'CHNAM' ).
      LR_COLUMN->SET_VISIBLE( ABAP_FALSE ).
    CATCH CX_SALV_NOT_FOUND.
  ENDTRY.

  TRY .
      LR_COLUMN  ?= LR_COLUMNS->GET_COLUMN( 'CHDAT' ).
      LR_COLUMN->SET_VISIBLE( ABAP_FALSE ).
    CATCH CX_SALV_NOT_FOUND.
  ENDTRY.

  TRY .
      LR_COLUMN  ?= LR_COLUMNS->GET_COLUMN( 'CHTIM' ).
      LR_COLUMN->SET_VISIBLE( ABAP_FALSE ).
    CATCH CX_SALV_NOT_FOUND.
  ENDTRY.

  GR_TABLE->DISPLAY( ).

ENDFORM.

FORM FRM_READ_DOMAIN_TEXT  USING    IV_KEY
                                IV_DOMNAME
                       CHANGING CV_TEXT.
  DATA:
    LS_TAB TYPE DD07V,
    LT_TAB TYPE STANDARD TABLE OF DD07V.

  CLEAR CV_TEXT.

  CALL FUNCTION 'DD_DOMVALUES_GET'
    EXPORTING
      DOMNAME        = IV_DOMNAME
      TEXT           = 'X'
    TABLES
      DD07V_TAB      = LT_TAB
    EXCEPTIONS
      WRONG_TEXTFLAG = 1
      OTHERS         = 2.

  IF SY-SUBRC <> 0.
    RETURN.
  ENDIF.

  LOOP AT LT_TAB INTO LS_TAB.
    IF LS_TAB-DOMVALUE_L = IV_KEY.
      CV_TEXT = LS_TAB-DDTEXT.
      EXIT.
    ENDIF.
  ENDLOOP.
ENDFORM.                    " READ_DOMAIN_TEXT
